package demo1;

public class Login {
    public String password="123";
    public String name="baibai";

    public void  denglu(String password,String name)throws NameErrorException,PasswordErrorException {
            try{
                if(!this.password.equals(password)){
                    throw new PasswordErrorException("输入的密码异常"+password);//这里一定是new PasswordErrorException()
                }
                if(!this.name.equals(name)){
                    throw new NameErrorException("输入的用户名异常"+name);
                }
            }catch (PasswordErrorException e){
                e.printStackTrace();
            }catch (NameErrorException e){
                e.printStackTrace();
            }
    }
}
